#ifndef THREAD_H
#define THREAD_H

#include <thread>
#include "thread.h"

class Thread
{
public:
    Thread(){}
    ~Thread(){
        if(thread_) {
            Stop();
        }
    }

    int Start() {}
    int Stop() {
        abort_ = 1;
        if(thread_) {
            thread_->join();
            delete thread_;
            thread_ = nullptr;
        }
        return 0;
    }

protected:
    virtual void Run() = 0;

    int abort_ = 0;
    std::thread *thread_ = nullptr;
};

#endif // THREAD_H
